﻿using System;
using System.Configuration;

namespace Oya.Data
{
    /// <summary>
    /// Class to access configuration of the app
    /// </summary>
   public class AppConfigurationDAC
    {
        static AppConfigurationDAC()
        {
            //that exposes the property  AppConfigurationDAC.Config for all app to read the config...
            ReadSessionConfiguration();
        }
        private  static OyaConfigurationContext config ;

        public static OyaConfigurationContext Config
        {
            get { return config; }
            set { config = value; }
        }

        /// <summary>
        /// this initialize  by reading app.config.
        /// </summary>
        public static void ReadSessionConfiguration()   
        {
            try
            {
                //we read the param that are into the config of the host.
                config = new OyaConfigurationContext(ConfigurationManager.AppSettings);

            }
            catch (Exception e)
            {
                //logic to tell if ...
            }

        }
    }
}
